import React, { Component, useState } from "react";
import MyContext from "./myContext";
import Son from "./Son";

export default function UseContextDemo() {

  const [money,setMoney] = useState(100);

  return (
    <MyContext.Provider value={money}>
      <div>
        <h1>useContext示例：</h1>
        <p>money:{money}</p>
        <input type="button" value="修改money" onClick={()=>setMoney(money+100)} />
        <Son></Son>
      </div>
    </MyContext.Provider>
  );
}
